home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Examples / Bitmap / Include / BmpSel.h < prev   
Encoding:
Text File  |  1994-04-21  |  3.6 KB  |  120 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                BmpSel.h
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //    Creation Date:        3/28/94
  8. //
  9. //    Copyright:    © 1993, 1994 by Apple Computer, Inc., all rights reserved.
  10. //
  11. //========================================================================================
  12.  
  13. #ifndef BMPSEL_H
  14. #define BMPSEL_H
  15.  
  16. // ----- FrameWork Includes -----
  17.  
  18. #ifndef FWSELECT_H
  19. #include "FWSelect.h"
  20. #endif
  21.  
  22. // ----- Graphic Includes -----
  23.  
  24. #ifndef FWRECT_H
  25. #include "FWRect.h"
  26. #endif
  27.  
  28. #ifndef FWPAT_H
  29. #include "FWPat.h"
  30. #endif
  31.  
  32. //========================================================================================
  33. //    •• Forward Declarations
  34. //========================================================================================
  35.  
  36. class CBitmapPart;
  37. class CBitmapFacet;
  38. class FW_CGraphicContext;
  39.  
  40. //========================================================================================
  41. //    •• class CBitmapSelection
  42. //========================================================================================
  43.  
  44. class CBitmapSelection : public FW_CSelection
  45. {
  46. //----------------------------------------------------------------------------------------
  47. //    • Initialization/Destruction
  48. //
  49. public:
  50.     CBitmapSelection();
  51.     void            InitBitmapSelection(CBitmapPart* thePart);
  52.     virtual         ~CBitmapSelection();
  53.     
  54. //----------------------------------------------------------------------------------------
  55. //    • Inherited API
  56. //
  57. public:
  58.     virtual void        CloseSelection();
  59.     virtual void        SelectAll();
  60.     virtual FW_Boolean    IsEmpty() const;
  61.     virtual FW_Boolean    DoClear();
  62.     
  63.     virtual void        ExternalizeSelection(XMPStorageUnit* storageUnit, FW_CFrame* commandFrame, XMPCloneKind cloneKind);
  64.     virtual FW_Boolean    InternalizeSelection(XMPStorageUnit* storageUnit, XMPCloneKind cloneKind);
  65.  
  66.     virtual XMPRgnHandle     CalcDragRgn(FW_CFacet* facet);
  67.     virtual XMPShape*    GetSelectionShape();
  68.  
  69. //----------------------------------------------------------------------------------------
  70. //    • New API
  71. //
  72. public:
  73.     void                GetSelectRect(FW_CRect& rect) const;
  74.     void                SetSelectRect(const FW_CRect& rect);
  75.     
  76.     FW_Boolean             Track(CBitmapFacet* facet, const FW_CPoint& anchorPoint, XMPEventData event, FW_CRect& rect);
  77.     FW_Boolean            InSelection(const FW_CPoint& where) const;
  78.  
  79.     void                MoveAnts();
  80.     void                DrawAnts(FW_CFrame* frame);
  81.     void                DoDrawAnts(FW_CGraphicContext* gc);
  82.     
  83. private:
  84.     void                GetSelectRectWithZoomFactor(CBitmapFacet* facet, FW_CRect& selectRect);
  85.     void                InternalizePICT(XMPStorageUnit* storageUnit);
  86.     void                InternalizeBitmap(XMPStorageUnit* storageUnit);
  87.     
  88. //----------------------------------------------------------------------------------------
  89. //    • Data Members
  90. //
  91. private:
  92.     CBitmapPart*        fBitmapPart;
  93.     FW_CRect            fSelectRect;
  94.     FW_Boolean            fHasSelection;
  95.     FW_CPattern            fAntPattern;
  96. };
  97.  
  98. //========================================================================================
  99. //    •• Inlines
  100. //========================================================================================
  101.  
  102. //----------------------------------------------------------------------------------------
  103. // CBitmapSelection::GetSelectRect
  104. //----------------------------------------------------------------------------------------
  105. inline void CBitmapSelection::GetSelectRect(FW_CRect& rect) const
  106. {
  107.     rect = fSelectRect;
  108. }
  109.  
  110. //----------------------------------------------------------------------------------------
  111. // CBitmapSelection::SetSelectRect
  112. //----------------------------------------------------------------------------------------
  113. inline void CBitmapSelection::SetSelectRect(const FW_CRect& rect)
  114. {
  115.     fSelectRect = rect;
  116.     fHasSelection = TRUE;
  117. }
  118.  
  119.  
  120. #endif